package short_semester.questionnaire_planet.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import short_semester.questionnaire_planet.pojo.MultiChoiceQuestion;
import short_semester.questionnaire_planet.pojo.MultiChoiceQuestionRecord;
import short_semester.questionnaire_planet.pojo.QuestionnaireRecord;

import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;

public interface MultipleChoiceQuestionRecordDao extends JpaRepository<MultiChoiceQuestionRecord,Integer> {
    List<MultiChoiceQuestionRecord> findAllByQuestionnaireRecord(QuestionnaireRecord questionnaireRecord);

    Optional<MultiChoiceQuestionRecord> findByQuestionnaireRecordAndMultiChoiceQuestion(QuestionnaireRecord record,MultiChoiceQuestion question);
    
    @Modifying
    @Transactional
    void deleteByMultiChoiceQuestion(MultiChoiceQuestion multiChoiceQuestion);
}
